package demo1102.demo04;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/2 16:01
 */
public class TestThreadPoolExecutor {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 5, 2000, TimeUnit.SECONDS, new LinkedBlockingDeque(3));

        for (int i = 0; i < 8; i++) {
            final int a=i;
            threadPoolExecutor.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName()+"~~~~~~"+a);
                }
            });
        }
    }
}
